<?php
	####################################################
	# library import and object instance.              #
	####################################################
	include_once('./common.php');


	####################################################
	# request data($_POST AND $_GET FROM $_REQUEST)    #
	####################################################
	# REQUEST(get and post variables)
	$req = Request::clean_request($_REQUEST, TRUE);

	# GET(url variables)

	# POST(form variables)

	# Validation(special case validate)
	//*/
	Validation::check_is_emptys($req);
	Validation::check_is_idpw($req['mpasswd']);
	Validation::check_is_idpw($req['mpasswdc']);
	Validation::check_is_equal($req['mpasswd'],$req['mpasswdc']);
	//Nlog::xmp($req); //display clean and remmap values
	//*/
	####################################################
	# implementation                                   #
	####################################################

	# 세션에 muid값을 확인 후 없으면 error
	if(empty($_SESSION['muid']) == TRUE){
		Mover::error("error", NULL);
	} else {
		//Nlog::xmp($_SESSION);
	}

	# 업데이트 한다.
	$ret = $db->query(
		sprintf("UPDATE `n_member` SET `mpasswd`='%s' WHERE `muid`='%s';",
			$req['mpasswd'],
			$_SESSION['muid']
		)
	);

?>
<?php
	$html->custom_header(TITLE);
	$html->custom_js("{$JS}jquery.1.7.1.min.js");
	$html->custom_js("{$JS}lib.control.js");
	$html->custom_css("{$CSS}basic.css");
?>
<?$html->custom_body();?>
<?=$tmp->tiles_header()?>
	<h1>비밀번호 찾기</h1>
	<?php if($ret): ?>
		새로운 비밀번호 세팅이 완료 되었습니다.
	<?php else: ?>
		새로운 비밀번호 세팅이 실패 하였습니다.
	<?php endif; ?>
	<?=NTool::btn("인덱스", "Mover.home();");?>
<?=$tmp->tiles_footer()?>
<?php $html->html_footer(); ?>